﻿<Window x:Class="Cratos.Generator.OpenProjectView"
				xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
				xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
				xmlns:cm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
				xmlns:local="clr-namespace:Cratos.Generator"
				Title="Open Project" Height="200" Width="450" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow">
	<Window.Resources>
		<CollectionViewSource x:Key="allProjects" Source="{Binding AllProjects}">
			<CollectionViewSource.SortDescriptions>
				<cm:SortDescription PropertyName="Name" />
			</CollectionViewSource.SortDescriptions>
		</CollectionViewSource>
	</Window.Resources>

	<Window.CommandBindings>
		<CommandBinding Command="{x:Static local:OpenProjectView.OpenProjectCommand}"
										Executed="OnOpenProjectCommand" CanExecute="OnOpenProjectCommandCanExecute" />
		<CommandBinding Command="{x:Static local:OpenProjectView.CancelCommand}"
										Executed="OnCancelCommand" CanExecute="OnCancelCommandCanExecute" />
	</Window.CommandBindings>

	<DockPanel>
		<Border x:Name="m_BorderProgress" DockPanel.Dock="Bottom" Visibility="Hidden"
								Background="{StaticResource lightBlueBrush}" Style="{StaticResource groupBoxHeader}">
			<TextBlock x:Name="m_LblProgress" HorizontalAlignment="Center" VerticalAlignment="Center" 
								 Visibility="Hidden" Text="Progress" />
		</Border>

		<StackPanel DockPanel.Dock="Bottom" Style="{StaticResource buttonPanel}">
			<Button Style="{StaticResource openButton}" DockPanel.Dock="Right" Command="{x:Static local:OpenProjectView.OpenProjectCommand}">
				<StackPanel Orientation="Horizontal">
					<Image Source="../Images/accept.png" Margin="0 1 1 0" Height="20" />
					<TextBlock Text="Open Project" Margin="0 1" Padding="2" FontWeight="Bold" />
				</StackPanel>
			</Button>

			<Button Style="{StaticResource openButton}" DockPanel.Dock="Right" Command="{x:Static local:OpenProjectView.CancelCommand}">
				<StackPanel Orientation="Horizontal">
					<Image Source="../Images/cancel.png" Margin="0 1 1 0" Height="20" />
					<TextBlock Text="Cancel" Margin="0 1" Padding="2" FontWeight="Bold" />
				</StackPanel>
			</Button>
		</StackPanel>

		<ListView x:Name="m_ListProjects" ItemsSource="{Binding Source={StaticResource allProjects}}"
							SelectedItem="{Binding Project}">
			<ListView.View>
				<GridView>
					<GridViewColumn DisplayMemberBinding="{Binding Name}">
						<GridViewColumn.Header>
							<TextBlock Style="{StaticResource listColHeader}">Name</TextBlock>
						</GridViewColumn.Header>
					</GridViewColumn>
				</GridView>
			</ListView.View>
		</ListView>
	</DockPanel>
</Window>
